#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

void reveres(int* nums, int begin, int end) {
    while (begin < end) {
        int tmp = nums[begin];
        nums[begin] = nums[end];
        nums[end] = tmp;
        begin++;
        end--;
    }
}

void rotate(int* nums, int numsSize, int k) {
    if (k > numsSize) {
        k %= numsSize;
    }
    reveres(nums, 0, numsSize - 1);
    reveres(nums, 0, k - 1);
    reveres(nums, k, numsSize - 1);
}

int main()
{
    int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };
    int sz = sizeof(arr) / sizeof(arr[0]);
    int k = 0;
    scanf("%d", &k);
    rotate(arr, sz, k);
    for(int i=0;i<sz;i++)
    {
        printf("%d ", arr[i]);
    }
	return 0;
}

